import '../net_cancel.dart';
import 'base_intercept.dart';

/// @Author: JYX
/// @CreateDate: 2020/6/1  9:13
/// @Description:  加载进度条
class ShowLoadingIntercept extends BaseIntercept {
  String tip;

  ShowLoadingIntercept(NetCancel baseFunction,
      {this.tip = '加载中',
      bool isDefaultDealFailure = true,
      bool isShowTopReminder = true}) {
    this.netCancel = baseFunction;
    this.isDefaultDealFailure = isDefaultDealFailure;
    this.isShowTopReminder = isShowTopReminder;
  }

  @override
  void afterRequest() {
    if (netCancel != null) {
      netCancel.setLoadingWidgetDismiss(false, tip: tip);
    }
  }

  @override
  void beforeRequest() {
    if (netCancel != null) {
      /// 网络加载框
      netCancel.setLoadingWidgetVisible(true, tip: tip);
    }
  }
}
